package cn.edu.scau.cmi.liguanwu.factory;

import java.net.URL;
import java.util.ResourceBundle;

import cn.edu.scau.cmi.liguanwu.simpleFactory.*;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class Controller {
	@FXML
	private TextField textfield;
	@FXML
	private TextArea textarea;
	@FXML
	private Button button;
	public void initialize(URL location, ResourceBundle resources) {
	}
	public void onClick(ActionEvent event) {
		String option = textfield.getText();
		meatFactory factory = null;
		if(option.equals("pork")) {factory = new PorkMeatFactory();}
		else if(option.equals("chicken")) {factory = new ChickenMeatFactory();}
		else if(option.equals("beef")) {factory = new BeefMeatFactory();}
		else factory = new geterror();
		Meat m = factory.getM();
		textarea.setText(m.getmeat());
	}
}
